﻿<Window x:Class="TestAvatarSelector"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="TestAvatarSelector" Height="300" Width="300" Name="wnd">
    <Grid DataContext="{Binding ElementName=wnd}" Margin="8">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ListBox Grid.ColumnSpan="2" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding ViewModel.SelectedImageFile}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding ViewModel.ImageFiles}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel IsItemsHost="True" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border CornerRadius="4" BorderBrush="Gray" BorderThickness="2" Margin="2">
                        <Image Width="48" Height="48" Source="{Binding }" />
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
            <Button Content="Add new image" Click="OnAddNewImageClick" />
        </StackPanel>
        <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Select" Click="OnSelectImageClick" />
            <Button Content="Cancel" Click="OnCancelSelectClick" />
        </StackPanel>
    </Grid>
</Window>
